package com.thirtydays.frame.base.http


import com.thirtydays.frame.BuildConfig
import com.thirtydays.frame.base.http.okhttp.OkHttpManager
import com.thirtydays.frame.data.DataManager
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

/**
 * @创建者：小垚
 * @时间：2021/7/2211:33
 * @描述：
 */
object HttpManager {
    val api by lazy {
        val retrofit = Retrofit.Builder()
            .baseUrl(BuildConfig.BASE_URL)
            .client(OkHttpManager.get())
            .addConverterFactory(GsonConverterFactory.create())
            .build()
        retrofit.create(ApiService::class.java)!!
    }

    fun getHttp(baseUrl: String): ApiService {
        val retrofit = Retrofit.Builder()
            .baseUrl(baseUrl)
            .client(OkHttpManager.get())
            .addConverterFactory(GsonConverterFactory.create())
            .build()
        return retrofit.create(ApiService::class.java)!!
    }

}